﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Fa.Kanbox.API.Demo
{
    public partial class FPendingShares : Form
    {
        public FPendingShares()
        {
            InitializeComponent();
        }

        private void tsmiAccept_Click(object sender, EventArgs e)
        {
            var item = listView1.SelectedItems[0];
            MyGlobal.ApiClient.GetPendingShareInfos();
        }

        private void tsmiNotAccept_Click(object sender, EventArgs e)
        {

        }

        private void listView1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right && listView1.SelectedItems.Count > 0)
            {
                contextMenuStrip1.Show(listView1, e.Location);
            }
        }

        private void FPendingShares_Shown(object sender, EventArgs e)
        {
            var pndingShareInfo = MyGlobal.ApiClient.GetPendingShareInfos(); MessageBox.Show(pndingShareInfo.Pending.Count.ToString());
            listView1.Items.Clear();
            foreach (var info in pndingShareInfo.Pending)
            {
                var item = listView1.Items.Add(new ListViewItem(info.Path)
                {
                    Tag = info
                });
                item.SubItems.Add(info.User);
                item.SubItems.Add(info.Message);
            }
        }
    }
}
